package com.zjitc.service.impl;

import com.zjitc.dao.CategoryDao;
import com.zjitc.dao.CategorySecondDao;
import com.zjitc.model.Category;
import com.zjitc.model.CategorySecond;
import com.zjitc.service.CategoryService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/4/26 13:47
 * @description:
 */
@Service
public class CategoryServiceImpl implements CategoryService {

  @Autowired
  private CategoryDao categoryDao;

  @Autowired
  private CategorySecondDao categorySecondDao;

  @Override
  public List<Category> findAllCategory() {
    List<Category>list=categoryDao.findAllCategory();
    for(Category c:list) {
      List<CategorySecond> cslist=categorySecondDao.findByCid(c.cid);
      c.setCategorySecondList(cslist);
    }
    return list;
  }
}
